import { CommonEntity } from '../../../dto/common.entity';
import { IsNotEmpty } from 'class-validator';
import { Column, Entity } from 'typeorm';

export enum orderStatustype {
  PAYMENT_OVER = 'paymentOver',
  REFUND = 'refund',
}

@Entity('order')
export class Order extends CommonEntity {
  @Column({
    comment: '名称',
  })
  name: string;

  @Column({
    comment: '订单号',
  })
  @IsNotEmpty()
  orderCode: string;

  @Column({
    comment: '手机号',
    default: '15228626246',
  })
  tel: string;

  @Column({
    comment: '购买者',
  })
  userId: string;

  @Column({
    comment: '购买状态',
    default: orderStatustype.PAYMENT_OVER,
  })
  status: orderStatustype;

  @Column({
    comment: '购买数量',
  })
  buyNum: number;

  @Column({
    comment: '购买金额',
  })
  buyPrice: string;

  @Column({
    comment: '购买商品',
  })
  productId: string;

  @Column({
    comment: '购买时间',
    type: 'timestamp',
  })
  buyTime: string;

  @Column({
    comment: '所属门店',
    nullable: true,
  })
  orgId: string;

  @Column({
    comment: '所属门店名称',
    nullable: true,
  })
  orgName: string;

  @Column({
    comment: '所属门店封面',
    nullable: true,
  })
  orgLogo: string;

  @Column({
    comment: '所属商品封面',
    nullable: true,
  })
  productLogo: string;

  @Column({
    comment: '所属商品名称',
    nullable: true,
  })
  productName: string;

  @Column({
    comment: '所属商品类型',
    nullable: true,
  })
  productType: string;
}
